package com.example.volunteer.mapper;


import com.example.volunteer.model.Activity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;


import java.util.Date;
import java.util.List;

@Mapper
public interface ActivityMapper {
    void insert(Activity activity);
    void update(Activity activity);
    void updateStatus(Integer activityId, String status);
    Activity findById(Integer activityId);
    void delete(Integer activityId);
    // 分页查询方法
    List<Activity> findByTitleWithPage(@Param("title") String title, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByTitle(@Param("title") String title);

    List<Activity> findByStartTimeWithPage(@Param("startTime") Date startTime, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByStartTime(@Param("startTime") Date startTime);

    List<Activity> findByEndTimeWithPage(@Param("endTime") Date endTime, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByEndTime(@Param("endTime") Date endTime);

    List<Activity> findByAddressWithPage(@Param("address") String address, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByAddress(@Param("address") String address);

    List<Activity> findByParticipantLimitWithPage(@Param("participantLimit") Integer participantLimit, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByParticipantLimit(@Param("participantLimit") Integer participantLimit);

    List<Activity> findByCreatedTimeWithPage(@Param("createdTime") Date createdTime, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByCreatedTime(@Param("createdTime") Date createdTime);

    List<Activity> findByAdminIdWithPage(@Param("adminId") String adminId, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByAdminId(@Param("adminId") String adminId);

    List<Activity> findByStatusWithPage(@Param("status") String status, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByStatus(@Param("status") String status);

    List<Activity> findUpcomingActivitiesWithPage(@Param("now") Date now, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countUpcomingActivities(@Param("now") Date now);

    int countActivities();
    List<Activity> findActivitiesWithPage(@Param("offset") int offset,
                                          @Param("pageSize") int pageSize);
}